package com.sun.utils;

import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class Stream {

    public static void main(String[] args) {
        Map<Integer,String> map = new HashMap<>(16);
        map.put(1,"A");
        map.put(2,"B");
        map.put(3,"C");
        map.put(4,"D");
        map.put(5,"E");
        map.put(6,"F");
        //遍历
        map.entrySet().stream().forEach(System.out::println);

        List<String> collect = map.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList());
        System.out.println(collect);
        System.out.println("-----------------------");
        List<String> list = map.entrySet().stream().filter(x -> x.getKey() > 3).map(Map.Entry::getValue).sorted(Comparator.reverseOrder()).collect(Collectors.toList());
        System.out.println(list);


    }
}
